package com.xinchuang.mapper.targetSystem.scene;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xinchuang.entity.targetSystem.scene.SceneSubList;
import com.xinchuang.entity.targetSystem.scene.SceneTargetList;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName SceneTargetListMapper
 * @Description: TODO(写一段描述的话)
 * @Author zhangxuan
 * @Date 2024-05-14 15:12
 * @Verion V1.0
 */
public interface SceneSubListMapper extends BaseMapper<SceneSubList> {

    @Select(value = {
            "SELECT * FROM scene_sub_list WHERE scene_id = #{sceneId} AND target_id = #{targetId}"
    })
    @Results(value = {
            @Result(property = "missile", column = "missile"),
            @Result(property = "payload", column = "payload"),
            @Result(property = "missileName", one = @One(select = "com.xinchuang.mapper.targetSystem.scene.SceneSystemsListMapper.getMissileName"), column = "missile"),
            @Result(property = "payloadName", one = @One(select = "com.xinchuang.mapper.targetSystem.scene.SceneSystemsListMapper.getWeaponName"), column = "payload")
    })
    List<SceneSubList> selectSubList(String sceneId, String targetId);

}
